package com.briup.jdbc;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Map;

/**
 * 使用工具类，完成DDL的测试
 */
public class Test9 {
    public static void main(String[] args) throws SQLException {
//        String sql = "create table t_user("
//                + "id int primary key,"
//                + "name varchar(50) not null,"
//                + "age int"
//                + ")";
//        JdbcUtil.executeDmlOrDdl(sql);

        String sql = "select * from t_user";
        Map<String, Object> map = JdbcUtil.executeDql(sql);
        ResultSet rs = (ResultSet)map.get("resultSet");
        Statement st = (Statement)map.get("statement");
        Connection conn = (Connection)map.get("connection");
        while(rs.next()){
            System.out.println(rs.getInt(1));
        }
        JdbcUtil.close(conn,st,rs);
    }
}
